package br.com.betioli.jme.games.sokobob.layer;

import br.com.betioli.jme.games.sokobob.config.GameConfig;
import javax.microedition.lcdui.game.TiledLayer;

public class BackLayer extends TiledLayer {

    public BackLayer(char[][] level) {
        super(GameConfig.COLUMNS, GameConfig.ROWS, GameConfig.IMAGES, GameConfig.TILE_WIDTH, GameConfig.TILE_HEIGHT);

        for (int r = 0; r < GameConfig.ROWS; r++) {
            for (int c = 0; c < GameConfig.COLUMNS; c++) {
                
                if (level[c][r] == GameConfig.FLOWERS_REF) {
                    setCell(c, r, GameConfig.FLOWERS_TILE_INDEX);
                } else if ((level[c][r] != GameConfig.TARGET_REF) && (level[c][r] != GameConfig.WALL_REF)) {
                    setCell(c, r, GameConfig.GRASS_TILE_INDEX);
                }
            }
        }
    }
}
